package org.seven.jrdp.web.t;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.seven.jrdp.biz.t.service.TCkdService;
import org.seven.jrdp.commons.model.Result;
import org.seven.jrdp.commons.mybatis.model.PageRequest;
import org.seven.jrdp.commons.util.ServletUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import com.github.pagehelper.PageInfo;

@RestController
@RequestMapping("/mgt/t/qxck")
public class TQxckController {
	@Autowired
	private TCkdService tCkdService;

	@GetMapping("/{view}")
	public ModelAndView view(@PathVariable String view) {
		return new ModelAndView("mgt/t/qxck/qxck_" + view);
	}

	@PostMapping("/find")
	public PageInfo<Map<String, Object>> find(PageRequest pageRequest, HttpServletRequest request) {
		Map<String, Object> map = ServletUtils.getSearchParams(request);
		PageInfo<Map<String, Object>> page = tCkdService.findQxck(map, pageRequest);
		return page;
	}

	@RequestMapping("/qrqx")
	public Result qrqx(String id) {
		tCkdService.qxck(id);
		return Result.SUCCESS;
	}
}